// ----------------------------------
// RSDK Project: Sonic 1/Sonic 2
// Script Description: Warp Block Object
// Script Author: Christian Whitehead/Simon Thomley
// Unpacked by Rubberduckycooly's script unpacker
// ----------------------------------

//-------Aliases-------//
private alias 17 : TYPE_WARPBLOCK

// Function declarations
reserve function WarpBlock_DebugDraw
reserve function WarpBlock_DebugSpawn

// Static Values

// Tables

function WarpBlock_DebugDraw
	DrawSprite(0)
end function


function WarpBlock_DebugSpawn
	temp5 = 17
	temp4 = 0
	CallFunction(DebugMode_SpawnObject)
	object[arrayPos0].drawOrder = 4
	object[arrayPos0].groupID = GROUP_BLOCKS
end function


event ObjectMain
	if object.state == 1
		object.frame = object.value0
		object.frame >>= 3
		object.value0++
		if object.value0 == 32
			object.value0 = 0
			object.state = 0
			object.frame = 0
		end if
	end if
	foreach (GROUP_PLAYERS, currentPlayer, ACTIVE_ENTITIES)
		CallFunction(SpecialSetup_Function10)
	next
end event


event ObjectDraw
	CallFunction(SpecialSetup_Function9)
	DrawSpriteXY(object.frame, temp0, temp1)
end event


event ObjectStartup
	LoadSpriteSheet("Special/Objects.gif")
	SpriteFrame(-12, -12, 24, 24, 301, 176)
	foreach (TypeName[Warp Block], arrayPos0, ALL_ENTITIES)
		object[arrayPos0].groupID = GROUP_BLOCKS
	next
	SetTableValue(TypeName[Warp Block], DebugMode_ObjCount, DebugMode_TypeTable)
	SetTableValue(WarpBlock_DebugDraw, DebugMode_ObjCount, DebugMode_DrawTable)
	SetTableValue(WarpBlock_DebugSpawn, DebugMode_ObjCount, DebugMode_SpawnTable)
	DebugMode_ObjCount++
end event

event RSDKDraw
	DrawSprite(0)
end event

event RSDKLoad
	LoadSpriteSheet("Special/Objects.gif")
	SpriteFrame(-12, -12, 24, 24, 301, 176)
end event
